using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace CoreRp
{
    /// <summary>
    /// 此异常为可控异常，将不会记录在日志中
    /// </summary>
    public class WebApiException : Exception
    {
        public HttpStatusCode Code { get; private set; }
        public String ExceptionMessage { get; set; }
        public WebApiException(HttpStatusCode code)
        {
            Code = code;
        }

        public WebApiException(HttpStatusCode code, string message) : base(message)
        {
            Code = code;
        }
        public WebApiException(string message) : base(message)
        {
            ExceptionMessage = message;
        }

        public WebApiException(string message, Exception innerException) : base(message, innerException)
        {
            ExceptionMessage = message;
            ExceptionMessage = innerException.Message;
        }
        public WebApiException(HttpStatusCode code, string message, Exception innerException) : base(message, innerException)
        {
            Code = code;
            ExceptionMessage = message;
            ExceptionMessage = innerException.Message;
        }
    }
}